Page({
  data: {
    showIptPanel: false,
    autoFocus: true,
    roomKey: '    '
  },
  getUserInfo(e) {
    if (e.detail.errMsg === 'getUserInfo:ok') {
      let nickName = e.detail.userInfo.nickName
      wx.setStorageSync('nickName', nickName)
      wx.setStorageSync('userInfo', e.detail.userInfo)
      this.showIptPanelFn()
      // wx.navigateTo({url: '/pages/undercover/undercover'})
    }
  },
  onShareAppMessage() {
    return {
      title: '聚会娱乐必备神器，各类互动游戏出题器！',
      path: '/pages/undercover/undercover'
    }
  },
  showIptPanelFn() {
    wx.setNavigationBarColor({
      frontColor: '#ffffff',
      backgroundColor: '#1d2124'
    })
    this.setData({
      showIptPanel: true,
      autoFocus: true
    })
  },
  copyEmail() {
    wx.setClipboardData({
      data: '905179839@qq.com',
      success (res) {}
    })
  },
  closePanel() {
    wx.setNavigationBarColor({
      frontColor: '#000000',
      backgroundColor: '#ffffff'
    })
    this.setData({
      showIptPanel: false
    })
  },
  bindiput(e) {
    this.setData({
      roomKey: e.detail.value
    })
  },
  focusInput() {
    this.setData({
      autoFocus: true
    })
  },
  submit() {
    wx.setStorageSync('roomKey', this.data.roomKey) 
    wx.navigateTo({
      url: '/pages/room/room'
    })
  },
  onShareAppMessage() {
    return {
      title: '聚会娱乐必备游戏——"谁是卧底"',
      path: '/pages/undercover/undercover'
    }
  }
})